import{_ as M,a as b,o,b as g,w as a,r as N,m as s,f as t,d as G,c as u,e as l,l as tt,q as d,t as i,F as f,H as w,p as K,n as et,B as at,M as nt,Y as C,$ as st,a0 as ot,K as A,W as it,a1 as lt,a2 as W,a3 as O,a4 as rt,A as dt,a5 as ct,D as ut,x as pt,y as _t}from"./index-c80Lh_is.js";import{S as mt}from"./StatusBadge-UNqSn95Q.js";import{S as ft}from"./SummaryView-SP5kl4lM.js";import{T as j}from"./TagList-Rh-3ygnt.js";import{_ as yt}from"./SubscriptionList.vue_vue_type_script_setup_true_lang-bUx_9c1d.js";import"./AccordionList-4Q_QXouZ.js";const vt={},gt={class:"card"},ht={class:"title"},bt={class:"body"};function kt(c,n){const e=b("KCard");return o(),g(e,{class:"data-card"},{default:a(()=>[s("dl",null,[s("div",gt,[s("dt",ht,[N(c.$slots,"title",{},void 0,!0)]),t(),s("dd",bt,[N(c.$slots,"default",{},void 0,!0)])])])]),_:3})}const Q=M(vt,[["render",kt],["__scopeId","data-v-6e083223"]]),$t={class:"service-traffic"},wt={class:"actions"},xt=G({__name:"DataPlaneTraffic",setup(c){return(n,e)=>(o(),u("div",$t,[s("div",wt,[N(n.$slots,"actions",{},void 0,!0)]),t(),l(Q,{class:"header"},{title:a(()=>[N(n.$slots,"title",{},void 0,!0)]),_:3}),t(),N(n.$slots,"default",{},void 0,!0)]))}}),X=M(xt,[["__scopeId","data-v-5bd1dbf9"]]),Bt=["B","kB","MB","GB","TB","PB","EB","ZB","YB"],Tt=["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],Ct=["b","kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],St=["b","kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],J=(c,n,e)=>{let k=c;return typeof n=="string"||Array.isArray(n)?k=c.toLocaleString(n,e):(n===!0||e!==void 0)&&(k=c.toLocaleString(void 0,e)),k};function F(c,n){if(!Number.isFinite(c))throw new TypeError(`Expected a finite number, got ${typeof c}: ${c}`);n={bits:!1,binary:!1,space:!0,...n};const e=n.bits?n.binary?St:Ct:n.binary?Tt:Bt,k=n.space?" ":"";if(n.signed&&c===0)return` 0${k}${e[0]}`;const x=c<0,I=x?"-":n.signed?"+":"";x&&(c=-c);let h;if(n.minimumFractionDigits!==void 0&&(h={minimumFractionDigits:n.minimumFractionDigits}),n.maximumFractionDigits!==void 0&&(h={maximumFractionDigits:n.maximumFractionDigits,...h}),c<1){const E=J(c,n.locale,h);return I+E+k+e[0]}const $=Math.min(Math.floor(n.binary?Math.log(c)/Math.log(1024):Math.log10(c)/3),e.length-1);c/=(n.binary?1024:1e3)**$,h||(c=c.toPrecision(3));const B=J(Number(c),n.locale,h),D=e[$];return I+B+k+D}const It={class:"title"},Dt={key:0},Kt=G({__name:"ServiceTrafficCard",props:{protocol:{},traffic:{default:void 0},direction:{default:"downstream"}},setup(c){const{t:n}=tt(),e=c,k=x=>{const I=x.target;if(x.isTrusted&&I.nodeName.toLowerCase()!=="a"){const h=I.closest(".service-traffic-card, a");if(h){const $=h.nodeName.toLowerCase()==="a"?h:h.querySelector("a");$!==null&&"click"in $&&typeof $.click=="function"&&$.click()}}};return(x,I)=>{const h=b("KBadge"),$=b("KSkeletonBox");return o(),g(Q,{class:"service-traffic-card",onClick:k},{title:a(()=>[l(h,{appearance:e.protocol==="passthrough"?"success":"info"},{default:a(()=>[t(i(d(n)(`data-planes.components.service_traffic_card.protocol.${e.protocol}`,{},{defaultMessage:d(n)(`http.api.value.${e.protocol}`)})),1)]),_:1},8,["appearance"]),t(),s("div",It,[N(x.$slots,"default",{},void 0,!0)])]),default:a(()=>{var B,D,E,R,P,L,q,U,z;return[t(),e.traffic?(o(),u(f,{key:0},[e.traffic.name.length>0?(o(),u("dl",Dt,[e.protocol==="passthrough"?(o(!0),u(f,{key:0},w([["http","tcp"].reduce((p,m)=>{var S;const y=e.direction;return Object.entries(((S=e.traffic)==null?void 0:S[m])||{}).reduce((V,[r,_])=>[`${y}_cx_tx_bytes_total`,`${y}_cx_rx_bytes_total`].includes(r)?{...V,[r]:_+(V[r]??0)}:V,p)},{})],(p,m)=>(o(),u(f,{key:m},[s("div",null,[s("dt",null,i(d(n)("data-planes.components.service_traffic_card.tx")),1),t(),s("dd",null,i(d(F)(p.downstream_cx_rx_bytes_total??0)),1)]),t(),s("div",null,[s("dt",null,i(d(n)("data-planes.components.service_traffic_card.rx")),1),t(),s("dd",null,i(d(F)(p.downstream_cx_tx_bytes_total??0)),1)])],64))),128)):e.protocol==="grpc"?(o(),u(f,{key:1},[s("div",null,[s("dt",null,i(d(n)("data-planes.components.service_traffic_card.grpc_success")),1),t(),s("dd",null,i(d(n)("common.formats.integer",{value:((B=e.traffic.grpc)==null?void 0:B.success)??0})),1)]),t(),s("div",null,[s("dt",null,i(d(n)("data-planes.components.service_traffic_card.grpc_failure")),1),t(),s("dd",null,i(d(n)("common.formats.integer",{value:((D=e.traffic.grpc)==null?void 0:D.failure)??0})),1)])],64)):e.protocol.startsWith("http")?(o(),u(f,{key:2},[(o(!0),u(f,null,w([((E=e.traffic.http)==null?void 0:E[`${e.direction}_rq_1xx`])??0].filter(p=>p!==0),p=>(o(),u("div",{key:p},[s("dt",null,i(d(n)("data-planes.components.service_traffic_card.1xx")),1),t(),s("dd",null,i(d(n)("common.formats.integer",{value:p})),1)]))),128)),t(),s("div",null,[s("dt",null,i(d(n)("data-planes.components.service_traffic_card.2xx")),1),t(),s("dd",null,i(d(n)("common.formats.integer",{value:((R=e.traffic.http)==null?void 0:R[`${e.direction}_rq_2xx`])??0})),1)]),t(),(o(!0),u(f,null,w([((P=e.traffic.http)==null?void 0:P[`${e.direction}_rq_3xx`])??0].filter(p=>p!==0),p=>(o(),u("div",{key:p},[s("dt",null,i(d(n)("data-planes.components.service_traffic_card.3xx")),1),t(),s("dd",null,i(d(n)("common.formats.integer",{value:p})),1)]))),128)),t(),s("div",null,[s("dt",null,i(d(n)("data-planes.components.service_traffic_card.4xx")),1),t(),s("dd",null,i(d(n)("common.formats.integer",{value:((L=e.traffic.http)==null?void 0:L[`${e.direction}_rq_4xx`])??0})),1)]),t(),s("div",null,[s("dt",null,i(d(n)("data-planes.components.service_traffic_card.5xx")),1),t(),s("dd",null,i(d(n)("common.formats.integer",{value:((q=e.traffic.http)==null?void 0:q[`${e.direction}_rq_5xx`])??0})),1)])],64)):(o(),u(f,{key:3},[s("div",null,[s("dt",null,i(d(n)("data-planes.components.service_traffic_card.tx")),1),t(),s("dd",null,i(d(F)(((U=e.traffic.tcp)==null?void 0:U[`${e.direction}_cx_rx_bytes_total`])??0)),1)]),t(),s("div",null,[s("dt",null,i(d(n)("data-planes.components.service_traffic_card.rx")),1),t(),s("dd",null,i(d(F)(((z=e.traffic.tcp)==null?void 0:z[`${e.direction}_cx_tx_bytes_total`])??0)),1)])],64))])):K("",!0)],64)):(o(),g($,{key:1,width:"10"}))]}),_:3})}}}),Y=M(Kt,[["__scopeId","data-v-c38fcb65"]]),Nt={class:"body"},Et=G({__name:"ServiceTrafficGroup",props:{type:{}},setup(c){const n=c;return(e,k)=>{const x=b("KCard");return o(),g(x,{class:et(["service-traffic-group",`type-${n.type}`])},{default:a(()=>[s("div",Nt,[N(e.$slots,"default",{},void 0,!0)])]),_:3},8,["class"])}}}),H=M(Et,[["__scopeId","data-v-baf4abf7"]]),Vt=c=>(pt("data-v-9792a3a8"),c=c(),_t(),c),Mt={"data-testid":"dataplane-warnings"},Rt=["data-testid","innerHTML"],Pt={key:0,"data-testid":"warning-stats-loading"},Lt={class:"stack","data-testid":"dataplane-details"},qt={class:"columns"},Ut={class:"status-with-reason"},zt={class:"columns"},At=Vt(()=>s("span",null,"Outbounds",-1)),Ft={"data-testid":"dataplane-mtls"},Gt={class:"columns"},Ot=["innerHTML"],Yt={key:0,"data-testid":"dataplane-subscriptions"},Ht=G({__name:"DataPlaneDetailView",props:{data:{}},setup(c){const n=at(),e=c,k=nt(()=>e.data.warnings.concat(...e.data.isCertExpired?[{kind:"CERT_EXPIRED"}]:[]));return(x,I)=>{const h=b("KTooltip"),$=b("DataCollection"),B=b("KCard"),D=b("RouterLink"),E=b("KInputSwitch"),R=b("KButton"),P=b("RouterView"),L=b("KAlert"),q=b("AppView"),U=b("DataSource"),z=b("RouteView");return o(),g(z,{params:{mesh:"",dataPlane:"",inactive:!1},name:"data-plane-detail-view"},{default:a(({route:p,t:m})=>[l(U,{src:`/meshes/${p.params.mesh}/dataplanes/${p.params.dataPlane}/stats/${e.data.dataplane.networking.inboundName}`},{default:a(({data:y,error:S,refresh:V})=>[l(q,null,O({default:a(()=>[t(),s("div",Lt,[l(B,null,{default:a(()=>[s("div",qt,[l(C,null,{title:a(()=>[t(i(m("http.api.property.status")),1)]),body:a(()=>[s("div",Ut,[l(mt,{status:e.data.status},null,8,["status"]),t(),e.data.dataplane.networking.type==="standard"?(o(),g($,{key:0,items:e.data.dataplane.networking.inbounds,predicate:r=>!r.health.ready,empty:!1},{default:a(({items:r})=>[l(h,{class:"reason-tooltip"},{content:a(()=>[s("ul",null,[(o(!0),u(f,null,w(r,_=>(o(),u("li",{key:`${_.service}:${_.port}`},i(m("data-planes.routes.item.unhealthy_inbound",{service:_.service,port:_.port})),1))),128))])]),default:a(()=>[l(d(st),{color:d(ot),size:d(A),"hide-title":""},null,8,["color","size"]),t()]),_:2},1024)]),_:2},1032,["items","predicate"])):K("",!0)])]),_:2},1024),t(),l(C,null,{title:a(()=>[t(i(m("data-planes.routes.item.last_updated")),1)]),body:a(()=>[t(i(m("common.formats.datetime",{value:Date.parse(e.data.modificationTime)})),1)]),_:2},1024),t(),e.data.dataplane.networking.gateway?(o(),u(f,{key:0},[l(C,null,{title:a(()=>[t(i(m("http.api.property.tags")),1)]),body:a(()=>[l(j,{tags:e.data.dataplane.networking.gateway.tags},null,8,["tags"])]),_:2},1024),t(),l(C,null,{title:a(()=>[t(i(m("http.api.property.address")),1)]),body:a(()=>[l(it,{text:`${e.data.dataplane.networking.address}`},null,8,["text"])]),_:2},1024)],64)):K("",!0)])]),_:2},1024),t(),l(B,{class:"traffic","data-testid":"dataplane-traffic"},{default:a(()=>[s("div",zt,[l(X,null,{title:a(()=>[l(d(lt),{display:"inline-block",decorative:"",size:d(A)},null,8,["size"]),t(`
                  Inbounds
                `)]),default:a(()=>[t(),l(H,{type:"inbound"},{default:a(()=>[l($,{items:e.data.dataplane.networking.gateway?((y==null?void 0:y.inbounds)??[]).map(r=>({...e.data.dataplane.networking.inbounds[0],name:r.name,port:Number(r.port),protocol:r.protocol})):e.data.dataplane.networking.inbounds},O({default:a(({items:r})=>[(o(!0),u(f,null,w(r,_=>(o(),u(f,{key:`${_.name}`},[(o(!0),u(f,null,w([(y||{inbounds:[]}).inbounds.find(v=>`${v.name}`==`${_.name}`)],v=>(o(),g(Y,{key:v,protocol:(v==null?void 0:v.protocol)??_.protocol,traffic:typeof S>"u"?v:{name:"",protocol:_.protocol,port:`${_.port}`}},{default:a(()=>[(o(!0),u(f,null,w([`${_.name.replace(`_${_.port}`,"").replace("localhost","")}:${_.port}`],T=>(o(),g(D,{key:T,to:{name:(Z=>Z.includes("bound")?Z.replace("-outbound-","-inbound-"):"data-plane-inbound-summary-overview-view")(String(d(n).name)),params:{service:T},query:{inactive:p.params.inactive?null:void 0}}},{default:a(()=>[t(i(T),1)]),_:2},1032,["to"]))),128)),t(),l(j,{tags:[{label:"kuma.io/service",value:_.tags["kuma.io/service"]}]},null,8,["tags"])]),_:2},1032,["protocol","traffic"]))),128))],64))),128))]),_:2},[e.data.dataplaneType==="delegated"?{name:"empty",fn:a(()=>[l(W,null,{message:a(()=>[t(`
                          This proxy is a delegated gateway therefore `+i(m("common.product.name"))+` does not have any visibility into inbounds for this gateway
                        `,1)]),_:2},1024)]),key:"0"}:void 0]),1032,["items"])]),_:2},1024)]),_:2},1024),t(),l(X,null,O({title:a(()=>[l(d(rt),{display:"inline-block",decorative:"",size:d(A)},null,8,["size"]),t(),At]),default:a(()=>[t(),t(),typeof S>"u"?(o(),u(f,{key:0},[typeof y>"u"?(o(),g(dt,{key:0})):(o(!0),u(f,{key:1},w([e.data.dataplane.networking.type!=="standard"?"upstream":"downstream"],r=>(o(),u(f,{key:r},[l(H,{type:"passthrough"},{default:a(()=>[l(Y,{protocol:"passthrough",traffic:y.passthrough},{default:a(()=>[t(`
                          Non mesh traffic
                        `)]),_:2},1032,["traffic"])]),_:2},1024),t(),l($,{predicate:p.params.inactive?void 0:_=>{var v,T;return((_.protocol==="tcp"?(v=_.tcp)==null?void 0:v[`${r}_cx_rx_bytes_total`]:(T=_.http)==null?void 0:T[`${r}_rq_total`])??0)>0},items:y.outbounds},{default:a(({items:_})=>[_.length>0?(o(),g(H,{key:0,type:"outbound","data-testid":"dataplane-outbounds"},{default:a(()=>[(o(!0),u(f,null,w(_,v=>(o(),g(Y,{key:`${v.name}`,protocol:v.protocol,traffic:v,direction:r},{default:a(()=>[l(D,{to:{name:(T=>T.includes("bound")?T.replace("-inbound-","-outbound-"):"data-plane-outbound-summary-overview-view")(String(d(n).name)),params:{service:v.name},query:{inactive:p.params.inactive?null:void 0}}},{default:a(()=>[t(i(v.name),1)]),_:2},1032,["to"])]),_:2},1032,["protocol","traffic","direction"]))),128))]),_:2},1024)):K("",!0)]),_:2},1032,["predicate","items"])],64))),128))],64)):(o(),g(W,{key:1}))]),_:2},[y?{name:"actions",fn:a(()=>[l(E,{modelValue:p.params.inactive,"onUpdate:modelValue":r=>p.params.inactive=r,"data-testid":"dataplane-outbounds-inactive-toggle"},{label:a(()=>[t(`
                      Show inactive
                    `)]),_:2},1032,["modelValue","onUpdate:modelValue"]),t(),l(R,{appearance:"primary",onClick:V},{default:a(()=>[l(d(ct),{size:d(A)},null,8,["size"]),t(`

                    Refresh
                  `)]),_:2},1032,["onClick"])]),key:"0"}:void 0]),1024)])]),_:2},1024),t(),l(P,null,{default:a(r=>[r.route.name!==p.name?(o(),g(ft,{key:0,width:"670px",onClose:function(_){p.replace({name:"data-plane-detail-view",params:{mesh:p.params.mesh,dataPlane:p.params.dataPlane},query:{inactive:p.params.inactive?null:void 0}})}},{default:a(()=>[(o(),g(ut(r.Component),{"dataplane-type":e.data.dataplaneType,gateway:e.data.dataplane.networking.gateway,inbounds:r.route.name.includes("-inbound-")?e.data.dataplane.networking.inbounds:[],data:r.route.name.includes("-inbound-")?(y==null?void 0:y.inbounds)||[]:(y==null?void 0:y.outbounds)||[]},null,8,["dataplane-type","gateway","inbounds","data"]))]),_:2},1032,["onClose"])):K("",!0)]),_:2},1024),t(),s("div",Ft,[s("h2",null,i(m("data-planes.routes.item.mtls.title")),1),t(),e.data.dataplaneInsight.mTLS?(o(!0),u(f,{key:0},w([e.data.dataplaneInsight.mTLS],r=>(o(),g(B,{key:r,class:"mt-4"},{default:a(()=>[s("div",Gt,[l(C,null,{title:a(()=>[t(i(m("data-planes.routes.item.mtls.expiration_time.title")),1)]),body:a(()=>[t(i(m("common.formats.datetime",{value:Date.parse(r.certificateExpirationTime)})),1)]),_:2},1024),t(),l(C,null,{title:a(()=>[t(i(m("data-planes.routes.item.mtls.generation_time.title")),1)]),body:a(()=>[t(i(m("common.formats.datetime",{value:Date.parse(r.lastCertificateRegeneration)})),1)]),_:2},1024),t(),l(C,null,{title:a(()=>[t(i(m("data-planes.routes.item.mtls.regenerations.title")),1)]),body:a(()=>[t(i(m("common.formats.integer",{value:r.certificateRegenerations})),1)]),_:2},1024),t(),l(C,null,{title:a(()=>[t(i(m("data-planes.routes.item.mtls.issued_backend.title")),1)]),body:a(()=>[t(i(r.issuedBackend),1)]),_:2},1024),t(),l(C,null,{title:a(()=>[t(i(m("data-planes.routes.item.mtls.supported_backends.title")),1)]),body:a(()=>[s("ul",null,[(o(!0),u(f,null,w(r.supportedBackends,_=>(o(),u("li",{key:_},i(_),1))),128))])]),_:2},1024)])]),_:2},1024))),128)):(o(),g(L,{key:1,class:"mt-4",appearance:"warning"},{alertMessage:a(()=>[s("div",{innerHTML:m("data-planes.routes.item.mtls.disabled")},null,8,Ot)]),_:2},1024))]),t(),e.data.dataplaneInsight.subscriptions.length>0?(o(),u("div",Yt,[s("h2",null,i(m("data-planes.routes.item.subscriptions.title")),1),t(),l(B,{class:"mt-4"},{default:a(()=>[l(yt,{subscriptions:e.data.dataplaneInsight.subscriptions},null,8,["subscriptions"])]),_:1})])):K("",!0)])]),_:2},[k.value.length>0||S?{name:"notifications",fn:a(()=>[s("ul",Mt,[(o(!0),u(f,null,w(k.value,r=>(o(),u("li",{key:r.kind,"data-testid":`warning-${r.kind}`,innerHTML:m(`common.warnings.${r.kind}`,r.payload)},null,8,Rt))),128)),t(),S?(o(),u("li",Pt,[t(`
              The below view is not enhanced with runtime stats (Error loading stats: `),s("strong",null,i(S.toString()),1),t(`)
            `)])):K("",!0)])]),key:"0"}:void 0]),1024)]),_:2},1032,["src"])]),_:1})}}}),te=M(Ht,[["__scopeId","data-v-9792a3a8"]]);export{te as default};
